﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using Ultility;
using System.Data.SqlClient;
using System.Data;

namespace Entity
{
    public partial class Entity_Renters : Component
    {
        DBAccess _access = new DBAccess();
        public Entity_Renters()
        {
            InitializeComponent();
        }

        public Entity_Renters(IContainer container)
        {
            container.Add(this);

            InitializeComponent();
        }

        public DataSet _Insert_Renter(string name, int sex, string cmnd, string noicap, string ngaycap, string diachi, string quanhuyen, string tinh, string quocgia, string dienthoai, string fax, string email, string didong)
        {
            //DataSet ds = new DataSet();
            SqlParameter[] para = {
                                      new SqlParameter("@name",SqlDbType.NVarChar),
                                      new SqlParameter("@sex",SqlDbType.Bit),
                                      new SqlParameter("@cmnd",SqlDbType.NVarChar),
                                      new SqlParameter("@noicap",SqlDbType.NVarChar),
                                      new SqlParameter("@ngaycap",SqlDbType.SmallDateTime),
                                      new SqlParameter("@diachi",SqlDbType.NVarChar),
                                      new SqlParameter("@quanhuyen",SqlDbType.NVarChar),
                                      new SqlParameter("@tinh",SqlDbType.NVarChar),
                                      new SqlParameter("@quocgia",SqlDbType.NVarChar),
                                      new SqlParameter("@dienthoai",SqlDbType.Char),
                                      new SqlParameter("@fax",SqlDbType.Char),
                                      new SqlParameter("@email",SqlDbType.NVarChar),
                                      new SqlParameter("@didong",SqlDbType.Char)
                                  };
            para[0].Value = name;
            para[1].Value = sex;
            para[2].Value = cmnd;
            para[3].Value = noicap;
            para[4].Value = ngaycap;
            para[5].Value = diachi;
            para[6].Value = quanhuyen;
            para[7].Value = tinh;
            para[8].Value = quocgia;
            para[9].Value = dienthoai;
            para[10].Value = fax;
            para[11].Value = email;
            para[12].Value = didong;
            return _access._ExcuteQuery("sp_Insert_Renter", para);
        }

        public DataSet _get_id_newest()
        {
            return _access._ExcuteQuery("sp_get_rentersIDnew", null);
        }
           
    }
}
